﻿using QFramework;
using UnityEngine;

namespace HKTools
{

    public class CMD_TCP_SendMsgS2C : AbstractCommand
    {
        string msg;

        public CMD_TCP_SendMsgS2C(string _msg)
        {
            msg = _msg;
        }

        protected override void OnExecute()
        {
            IHK_TcpServerSystem tcpServerSystem = this.GetSystem<IHK_TcpServerSystem>();

            if (!tcpServerSystem.IsServerRunning)
            {
                Debug.LogError("当前未启动 Server端，无法使用该指令！");
                return;
            }
            else
            {
                tcpServerSystem.SendMsg_ServerToAllClients(msg);
            }
        }
    }
}